﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Medora.Model;
using Medora.Model.Basic;

namespace Medora.DataContract
{
    public interface IRepository<T> where T : class
    {
    
        IQueryable<T> GetAll();
    
        T GetById(Guid id);
    
        void Add(T entity);
    
        void Update(T entity);
    
        void Delete(T entity);
    
        void Delete(Guid id);

        void DeleteWhere(Expression<Func<T, bool>> filter);
    
        IEnumerable<T> Get(Expression<Func<T, bool>> filter = null, Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null, string includeProperties = "");

        void OneFieldUpdate(T entity, Expression<Func<T, object>> field);
        void FieldSetUpdate(T entity, List<Expression<Func<T, object>>> fields);
        IEnumerable<T> GetTake(int pageSize, int page, Func<IQueryable<T>, IOrderedQueryable<T>> orderBy, Expression<Func<T, bool>> filter = null, string includeProperties = "");

        IEnumerable<T> GetTake(int pageSize, int page, Expression<Func<T, bool>> filter = null, SortInfo sortInfo = null,
                               string includeProperties = "");
        int GetCount(Expression<Func<T, bool>> filter = null);
    }
}
